home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1996 February
/
EnigmA AMIGA RUN 04 (1996)(G.R. Edizioni)(IT)[!][issue 1996-02][Skylink CD III].iso
/
earcd
/
util4
/
0utils.lha
/
0Utils
/
SRunSX.data
< prev
next >
Wrap
Text File
|
1995-09-05
|
3KB
|
129 lines
#ifdef TPLTER
SRunSX = {
NoParsing;
SHORT = {{ SRun Script Execute }};
DESCRIPTION = {{
This is a program very Similar to SRun;
in fact it is just an extension to SRun.
Additionally to the functionality SRun shows,
SRunSX examines its first argument, and if this
is a quoted scriptfile, it explicitely calls
"Execute".
This is a workaround for a bug in Kickstart 2.0-3.1
Boot Shell, which addes a space to the filename, if
a Script is enclosed in brackets an not called via
Execute.
RESULT
STDOUT: the output of the 'command' execution.
RC: returnvalue of SystemTags() or >=10
}};
NOTES = {{
SRunSX does currently ignore ReadArgs, this is due
to a bug(?) in readargs that removes some whitespace
and quotes from argstring even with /F option
Ok, now its 'slowly' becoming a hack ...
(and ok cbm shell IS a hack ...)
}};
EXAMPLES = {{
> echo > t:xxx "echo hallo"
> protect t:xxx +s
> t:xxx
hallo
> "t:xxx" ; beware of the quotes!
EXECUTE: Can't open t:xxx
object not found
> echo >"t:xxx " "echo error - this is the wrong script"
> "t:xxx" ; beware of the quotes!
error - this is the wrong script
> SRunSX "t:xxx"
hallo
> SRunSX echo hallo
hallo
}};
HISTORY = {{
20-02-95 b_noll created SRun.*
21-02-95 b_noll added version/format-prefix/offset
20-03-95 b_noll added args diagnostics
09-04-95 b_noll shortened the file: arg Parsing dropped, removed NP_tags
10-04-95 b_noll copied 2 SRunSX.* Removed #ifdef PARSE added Examine
}};
includes = {
"<dos/dostags.h>",
"<string.h>",
"<exec/memory.h>"
};
Template = "/F/A";
Arguments = {{
STRPTR command;
}};
version = "1.3";
body = {{
// STRPTR template = FORMATPREFIX FORMAT;
STRPTR a;
BOOL sprot = NULL;
a = GetArgStr();
retval = RETURN_ERROR;
do {
/* ---- Skip spaces */
//while ((*a == ' ') || (*a == '\t')) ++a;
/* ---- check for quoted script file */
//if (*a == '"')
{
UBYTE buffer[MAXPATHLEN];
BPTR lock;
if (ReadItem (buffer, MAXPATHLEN, NULL) == ITEM_QUOTED)
if (lock = Lock(buffer, SHARED_LOCK)) {
struct FileInfoBlock *fib;
if (fib = AllocDosObject(DOS_FIB, NULL)) {
if (Examine (lock, fib))
sprot = fib->fib_Protection & FIBF_SCRIPT;
FreeDosObject (DOS_FIB, fib);
} /* if */
UnLock(lock);
} /* if */
} /* if */
if (sprot) {
STRPTR b;
if (!(b = AllocVec(strlen(a) + 10, MEMF_CLEAR))) {
retval = 20;
break;
} /* if */
strcpy (b, "Execute ");
strcpy (b + 8, a);
a = b;
} /* if */
retval = SystemTagList (a, NULL);
if (sprot)
FreeVec (a);
} while (0);
if (retval == -1) {
retval = RETURN_ERROR;
} /* if */
}};
};
#endif